1 <?php
2 session_start();
3 error_reporting(0);
4 include('includes/config.php');
5 if(strlen($_SESSION['login'])==0)
6 {
7 header('location:index.php');
8 }
9 else{
10 if(isset($_POST['submit5']))
11 {
12 $password=md5($_POST['password']);
13 $newpassword=md5($_POST['newpassword']);
14 $email=$_SESSION['login'];
15 $sql ="SELECT Password FROM tblusers WHERE EmailId=:email and Password=:password";
16 $query= $dbh -> prepare($sql);
17 $query-> bindParam(':email', $email, PDO::PARAM_STR);
18 $query-> bindParam(':password', $password, PDO::PARAM_STR);
19 $query-> execute();
20 $results = $query -> fetchAll(PDO::FETCH_OBJ);
21 if($query -> rowCount() > 0)
22 {
23 $con="update tblusers set Password=:newpassword where EmailId=:email";
24 $chngpwd1 = $dbh->prepare($con);
25 $chngpwd1-> bindParam(':email', $email, PDO::PARAM_STR);
26 $chngpwd1-> bindParam(':newpassword', $newpassword, PDO::PARAM_STR);
27 $chngpwd1->execute();
28 $msg="Your Password succesfully changed";
29 }
30 else {
31 $error="Your current password is wrong";
32 }
33 }
34
35 ?>
36 <!DOCTYPE HTML>
37 <html>
38 <head>
39 <title>TMS | Tourism Management System</title>
40 <meta name="viewport" content="width=device-width, initial-scale=1">
41 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
42 <meta name="keywords" content="Tourism Management System In PHP" />
43 <script type="applijewelleryion/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
44 <link href="css/bootstrap.css" rel='stylesheet' type='text/css' />
45 <link href="css/style.css" rel='stylesheet' type='text/css' />
46 <link href='//fonts.googleapis.com/css?family=Open+Sans:400,700,600' rel='stylesheet' type='text/css'>
47 <link href='//fonts.googleapis.com/css?family=Roboto+Condensed:400,700,300' rel='stylesheet' type='text/css'>
48 <link href='//fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>
49 <link href="css/font-awesome.css" rel="stylesheet">
50 <!-- Custom Theme files -->
51 <script src="js/jquery-1.12.0.min.js"></script>
52 <script src="js/bootstrap.min.js"></script>
53 <!--animate-->
54 <link href="css/animate.css" rel="stylesheet" type="text/css" media="all">
55 <script src="js/wow.min.js"></script>
56 <script>
57 new WOW().init();
58 </script>
59 <script type="text/javascript">
60 function valid()
61 {
62 if(document.chngpwd.newpassword.value!= document.chngpwd.confirmpassword.value)
63 {
64 alert("New Password and Confirm Password Field do not match !!");
65 document.chngpwd.confirmpassword.focus();
66 return false;
67 }
68 return true;
69 }
70 </script>
71 <style>
72 .errorWrap {
73 padding: 10px;
74 margin: 0 0 20px 0;
75 background: #fff;
76 border-left: 4px solid #dd3d36;
77 -webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
78 box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
79 }
80 .succWrap{
81 padding: 10px;
82 margin: 0 0 20px 0;
83 background: #fff;
84 border-left: 4px solid #5cb85c;
85 -webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
86 box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
87 }
88 </style>
89 </head>
90 <body>
91 <!-- top-header -->
92 <div class="top-header">
93 <?php include('includes/header.php');?>
94 <div class="banner-1 ">
95 <div class="container">
96 <h1 class="wow zoomIn animated animated" data-wow-delay=".5s" style="visibility: visible; animation-delay: 0.5s; animation-name: zoomIn;">TMS-Tourism Management System</h1>
97 </div>
98 </div>
99 <!--- /banner-1 ---->
100 <!--- privacy ---->
101 <div class="privacy">
102 <div class="container">
103 <h3 class="wow fadeInDown animated animated" data-wow-delay=".5s" style="visibility: visible; animation-delay: 0.5s; animation-name: fadeInDown;">Change Password</h3>
104 <form name="chngpwd" method="post" onSubmit="return valid();">
105 <?php if($error){?><div class="errorWrap"><strong>ERROR</strong>:<?php echo htmlentities($error); ?> </div><?php }
106 else if($msg){?><div class="succWrap"><strong>SUCCESS</strong>:<?php echo htmlentities($msg); ?> </div><?php }?>
107 <p style="width: 350px;">
108
109 <b>Current Password</b> <input type="password" name="password" class="form-control" id="exampleInputPassword1" placeholder="Current Password" required="">
110 </p>
111
112 <p style="width: 350px;">
113 <b>New Password</b>
114 <input type="password" class="form-control" name="newpassword" id="newpassword" placeholder="New Password" required="">
115 </p>
116
117 <p style="width: 350px;">
118 <b>Confirm Password</b>
119 <input type="password" class="form-control" name="confirmpassword" id="confirmpassword" placeholder="Confrim Password" required="">
120 </p>
121
122 <p style="width: 350px;">
123 <button type="submit" name="submit5" class="btn-primary btn">Change</button>
124 </p>
125 </form>
126
127
128 </div>
129 </div>
130 <!--- /privacy ---->
131 <!--- footer-top ---->
132 <!--- /footer-top ---->
133 <?php include('includes/footer.php');?>
134 <!-- signup -->
135 <?php include('includes/signup.php');?>
136 <!-- //signu -->
137 <!-- signin -->
138 <?php include('includes/signin.php');?>
139 <!-- //signin -->
140 <!-- write us -->
141 <?php include('includes/write-us.php');?>
142 </body>
143 </html>
144 <?php } ?>